<template>
  <div class="main">
    <!-- 全面图 -->
    <div class="brand">
      <div class="content">
        <h3>Daes   Huang</h3>
        <div class="cover-btn">
           <a class="btn btnColor" href="#indexCard"><i class="el-icon-milk-tea"></i> 开始阅读</a>
          <a class="btn btnColor" href="#a" ><i class="el-icon-edit"></i> 点击了解</a>
        </div>
         <div class="cover-link">
          <el-row :gutter="20">
            <el-col :span="4"><div class="grid-content bg-purple"><a href="https://space.bilibili.com/70433425/favlist"><i class="iconfont icon-wifi" style="font-size:26px; color:#fff;"></i></a></div></el-col>
            <el-col :span="4"><div class="grid-content bg-purple"><a href="https://gitee.com/daes/vue_shop"><i class="iconfont icon-GitHub" style="font-size:26px; color:#fff;"></i></a></div></el-col>
            <el-col :span="4"><div class="grid-content bg-purple"><a href="https://www.zhihu.com/people/shan-seng-26-89/posts"><i class="iconfont icon-zhihu" style="font-size:26px; color:#fff;"></i></a></div></el-col>
            <el-col :span="4"><div class="grid-content bg-purple"><a href="http://wpa.qq.com/msgrd?V=3&uin=810203055&Site=www.yudouyudou.com&Menu=yes"><i class="iconfont icon-QQ" style="font-size:26px; color:#fff;"></i></a></div></el-col>
            <el-col :span="4"><div class="grid-content bg-purple"><a href="http://mail.qq.com/cgi-bin/qm_share?t=qm_mailme&email=t9PW0sSFh4WH98bGmdTY2g"><i class="iconfont icon-youxiang" style="font-size:26px; color:#fff;"></i></a></div></el-col>
          </el-row>
         </div>
      </div>
    </div>

      <!-- 粒子特效 -->
    <vue-particles
        color="#fff"
        :particleOpacity="0.7"
        :particlesNumber="80"
        shapeType="circle"
        :particleSize="5"
        linesColor="#000"
        :linesWidth=".6"
        :lineLinked="true"
        :lineOpacity="0.4"
        :linesDistance="100"
        :moveSpeed="8"
        :hoverEffect="true"
        hoverMode="grab"
        :clickEffect="true"
        clickMode="push"
        class="particles"
      >
    </vue-particles>

    <a name ="indexCard"></a>
    <!-- 内容 -->
     <div class="container">
      <div class="center">
        <el-card class="card">
         <!-- 我的梦想 -->
          <div class="dream">
            <h3 class="f36"><i class="iconfont icon-deng f36"></i> 我的梦想</h3>
            <p>到三十岁的年纪，城里面有一套房，一个成功的工作室</p>
            <p>回到乡镇和自己兄弟住一个院子</p>
            <p>带着妻子环游世界，生活要过的充实！</p>
            <p>唯有坚持梦想，才能演绎成功的人生。</p>
            <p>让我们共同为梦而努力，为梦而奋斗，为梦创造奇迹。</p>
          </div>
         <!-- 喜爱的音乐 -->
          <div class="music">
              <h3 class="f36"><i class="iconfont icon-yinle f36"></i> BGM </h3>
            <div class="music_content mtop">
            <!-- 音乐播放器-->
              <Aplayer  :music="musicActive"  :list="musicData" :float="true" class="music_song" v-if="flag" :theme="this.randomColor()"/>
            </div>
          </div>
          <!-- 推荐文章 -->
          <div class="article">
             <h3 class="f36"><i class="iconfont icon-dianzan f36"></i> 推荐文章</h3>
             <div class="center page_axios mtop page_all">
              <h5>{{ moreAxios.title }}</h5>
              <p>{{ moreAxios.des }}</p>
              <keep-alive>
                <router-link :to="{ name: 'posts', params: { userId: moreAxios.id || 0 }}"  class="more">
                <i class="iconfont icon-yanjing"></i>
                <span>阅读更多</span>
                </router-link>
              </keep-alive>
             </div>

             <el-row class="center page_card mtop">
              <el-col :span="11" v-for="(item, i) in moreData.slice(1,3)" :key="i" ><div :class="{page_all:true, page_active: i == 1,page_actives: i == 0}">
              <h5>{{ item.title }}</h5>
              <p>{{ item.des }}</p>
              <router-link :to="{ name: 'posts', params: { userId: item.id }}"  class="more">
                <i class="iconfont icon-yanjing"></i>
                <span>阅读更多</span>
              </router-link>
              </div></el-col>
            </el-row>
          </div>
        </el-card>
      </div>
    </div>
    <!-- 联系方式-->
    <Contact />
    <!--尾部 -->
    <Footer />
  </div>

</template>

<script>
// eslint-disable-next-line no-unused-vars
import Contact from '../contact/Contact'
// eslint-disable-next-line no-unused-vars
import Footer from '../footer/Footer'

export default {
  data () {
    return {
      // 播放器默认列表
      musicActive: {
      },
      // 播放器数据数组
      musicData: [],
      flag: false,
      // 推荐文章数据
      moreData: [],
      // 头号文章
      moreAxios: {}
    }
  },
  methods: {
    // 获取音乐列表
    async getMusic () {
      var { data: res } = await this.$http.get('/music')
      if (res.meta.status !== 200) return alert('获取失败')
      this.musicData = res.data
      this.musicActive = this.musicData[0]
      // 当没有数据的时候 让插件不显示
      this.flag = true
    },
    musicClick (row) {
      this.musicActive = row
    },
    // 播放器颜色
    randomColor () {
      return `#${((Math.random() * 0xffffff) << 0).toString(16)}`
    },

    // 获取文章列表
    async getMore () {
      var { data: res } = await this.$http.get('/more', {
        params: {
          pagenum: 0,
          pagesize: 3
        }
      })
      if (res.meta.status !== 200) return alert('获取文章失败')
      // console.log(res.data)
      this.moreAxios = res.data.mores[0]
      this.moreData = res.data.mores
    }
  },
  created () {
    this.getMusic()
    this.getMore()
  },
  components: {
    Footer,
    Contact
  }
}
</script>

<style lang="less" scoped>
  .main{
    height: 100%;
    min-width: 100%;
  }
  .brand{
    position: relative;
    top:0;
    display: flex;
    height: 100%;
    width: 100%;
    background: url('//s1.ax1x.com/2020/05/24/YzyXkt.jpg') top;
    background-size: cover;
    z-index: 10;
  }
  .content{
    position:absolute;
    top:60%;
    left: 50%;
    -webkit-transform: translate(-50%, -50%);
    transform: translate(-50%, -50%);
    h3{
      color: #fff;
      font-weight: 400;
      font-size: 48px;
      text-align: center;
      margin-bottom: 150px;
    }
  }
  .particles{
    position: fixed;
    z-index: 1;
    height: 100%;
    width: 100%;
    top: 0;
    left: 0;
  }
  .cover-btn{
    width: 350px;
    display: flex;
    justify-content: space-between;
  }
  .btn{
    display: inline-block;
    background-color: rgba(255, 255, 255, 0.719);
    color: #409eff;
    font-size: 16px;
    padding: 12px 34px;
    border-radius: 25px;
    }
  .btnColor:hover{
    background-image: linear-gradient(to left,#ff2d66, #ff5940);
    color: #fff;
  }
  .cover-link{
    margin: 200px 0 0 40px;
    text-align: center;
  }
  .el-row{
    a{
      text-decoration: none;
    }
  }
  .container{
    padding: 40px 0;
    background-color: #eaeaea;
    min-height: 80%;
  }
  .center{
    width: 90%;
    margin: 0 auto;
    max-width: 1200px;
    height: 30%;
  }
  .el-card{
    border-radius: 5px;
    position: relative;
    z-index: 3;
  }
  .dream{
    margin: 20px 0;
    text-align: center;
    h3{
      margin-bottom: 40px;
    }
    p{
      line-height: 38px;
      color:#85929e;
      font-family:'KaiTi';
    }
  }
  .f36{
    text-align: center;
    font-size: 26px !important;
    color: #34495e !important;
    font-family:'KaiTi';
  }
  .mtop{
    margin-top: 40px;
  }
  .el-table{
    font-size: 12px;
  }
  .music{
    height: 100%;
    padding-top: 15px;
  }
  .music_content{
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    .music_song{
      width: 66%;
      max-width: 666px;
    }
  }
  .article{
    margin-top: 40px;
  }
  .page_all{
    height: 300px;
    background-size: cover;
    background-position: center;
    border-radius: 10px;
    color:#fff;
    text-align: center;
    transition: all .2;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    h5{
      padding-top: 40px;
      font-size: 20px;
      line-height: 40px;
    }
    p{
      margin-top: 60px;
      line-height: 20px;
    }
  }
  .page_axios{
    max-width: 80%;
    background-image: url('//s1.ax1x.com/2020/05/24/Yzy6OJ.jpg');
  }
  .page_actives{
    background-image: url('//s1.ax1x.com/2020/05/24/YzrNcQ.jpg');
    a{
      background-image: linear-gradient(to left,#c944f7, #ed4dbb);
    }
  }
  .page_active{
    background-image: url('//s1.ax1x.com/2020/05/24/YzyUwn.jpg');
    a{
      background-image: linear-gradient(to left,#1acbfc, #1d6ef1);
    }
  }
  .more{
      margin-top: 40px;
      display: inline-block;
      height: 40px;
      line-height: 40px;
      text-align: center;
      width: 110px;
      background-image: linear-gradient(to left,#ff2d66, #ff5940);
      border-radius: 25px;
      font-size: 14px;
      transition:  all .2s;
    }
    .page_card{
      display: flex;
      justify-content: space-between;
      align-self: center;
    }
  .more:hover{
    transform: scale(1.1);
  }

  @media screen and  (max-width:780px)  {
    .article{
      font-size: 13px;
    }
    .page_card h5{
      font-size: 18px !important;
    }
}

</style>
